import './stylus/index.styl'
import './scss/index.scss'
import axios from 'axios'

let title = document.querySelector('.title'),
  con = document.querySelector('.con');


[...title.children].forEach((v, i) => v.addEventListener('click', () => {
  title.querySelector('.active').classList.remove('active')
  v.classList.add('active')
  con.querySelector('.active').classList.remove('active')
  con.children[i].classList.add('active')
}))




axios.get('/list').then(resp => {
  console.log(resp.data);

  con.children[0].innerHTML = resp.data.map(item => {
    return `
      <dl>
        <dt><img src="${item.url}"></dt>
        <dd>${item.desc}</dd>
      </dl>
    `
  }).join('')
})